using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy_Skeleton : Enemy
{
    #region States
    public SkeletonIdleState IdleState {  get; private set; }
    public SkeletonMoveState MoveState { get; private set; }
    public SkeletonBattleState BattleState { get; private set; }
    public SkeletonAttackState AttackState { get; private set; }
    public SkeletonStunnedState StunnedState { get; private set; }
    public SkeletonDeadState DeadState { get; private set; }

    #endregion

    protected override void Awake()
    {
        base.Awake();

        IdleState = new SkeletonIdleState(stateMachine, this, "Idle", this);
        MoveState = new SkeletonMoveState(stateMachine, this, "Move", this);
        BattleState = new SkeletonBattleState(stateMachine, this, "Move", this);
        AttackState = new SkeletonAttackState(stateMachine, this, "Attack", this);
        StunnedState = new SkeletonStunnedState(stateMachine, this, "Stunned", this);
        DeadState = new SkeletonDeadState(stateMachine, this, "Died", this);
    }

    protected override void Start()
    {
        base.Start();
        stateMachine.Initialize(IdleState);
    }


    public override bool CanbeStunned()
    {
        if (base.CanbeStunned())
        {
            stateMachine.ChangeState(StunnedState);
            return true;
        }

        return false;
    }

    public override void Die()
    {
        base.Die();
        PlayerManager.instance.diedEnemies++;
        stateMachine.ChangeState(DeadState);
    }
}
